home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-05-19 | 39.1 KB | 1,063 lines |
- // Telix script modified for ProDoor Prompts & Modem Zone Language Prompt
- // Modify information in first 35 lines to match your system.
- int TRUE = 1 ;
-
- //
- // DSZ work areas
- //
- str Protocol[60] = "C:\TELIX\DSZ.COM" ; // Complete path to DSZ
- str Send_Command[64] = " handshake on sz "; // Cmnd passed to DSZ to send
- str Recv_Command[64] = " rz "; // Cmnd passed to DSZ to rcv
- str DSZ_Screen_Log[64] = "C:\TELIX\SCREEN.DSZ"; // Screen log file
- str DSZLOG[64] = "C:\TELIX\$DOOR.LOG"; // DSZLOG file name
- str logwork[100]; // DSZLOG work area
- int fh; // file handle for DSZLOG
-
- //
- // User name
- //
- str user_name[20] = "NODE CONFORUM"; // user name for logon
- str node_name[8] = "CONFORUM"; // Name of node getting mail
- str hub_name[8] = "HUBZN"; // Name of HUB you are contacting
- str dial_str[10] = "3 1"; // string of dial directory entries
- int dial_cnt = 100; // number of times to dial
- str hub_door[2] = "22"; // door to be used on hub
- str hub_conf[2] = "0"; // conference to be used on hub
-
- //
- // Mail work area
- //
- str Mail_upload[64] = "C:\TELIX\"; // dir of node upload file
- str Mail_download[64] = "C:\TELIX\"; // dir of node download file
- str Mail_save_dir[64] = "C:\TELIX\BACKUPS\"; // dir of mail save area
- str Mail_log_file[64] = "C:\TELIX\RELAY.LOG"; // log file for messages
- str Mail_run_good[] = "C:\TELIX\COMM.OK"; // file to create if good
- str Save_count[3] = "3"; // nbr of IN.RLY backups kept
-
- //
- // Misc work areas
- //
- str message_work[64]; // work area for message
- str node_packet[64]; // U/L packet name
- str node_file[64]; // U/L full file name
- str up_packet[64]; // U/L packet name
- str up_file[64]; // U/L full file name
- str Mail_packet[64]; // D/L packet name
- str Mail_file[64]; // D/L full file name
- str node_time[16]; // work area for message
- str node_date[16]; // work area for message
- str node_size[16]; // work area for message
- // str comm_byte[1]; // work area for screen
- // str screen_line1[78]; // work area for screen
- // str screen_line2[78]; // work area for screen
- // str screen_line3[78]; // work area for screen
- // str screen_line4[78]; // work area for screen
- // str screen_line5[78]; // work area for screen
- // str screen_line6[78]; // work area for screen
- // str screen_line7[78]; // work area for screen
- // str screen_line8[78]; // work area for screen
- // str screen_line9[78]; // work area for screen
- int n_isize = 0; // work area for message
- int n_itime; // work area for message
- int error_count; // keeps track of logon errors
- int first_time = 0; // screen write logic control
-
- //
- // Work areas used to reset system values
- //
- str old_down_dir[64]; // old download directory
- str old_up_dir[64]; // old upload directory
- int old_alarm_on; // old alarm value
- int old_zmod_auto; // old auto zmodem d/l
-
- int debug; // debugging flag
-
- int stat;
- int str_len;
-
- int tmark; // Timer pop value
- int Door_Timer; // Timer used for open door cmd
- int DialStat; // Status from dialing the hub
- int LogonStat; // Status returned from logon rtn
- int SendStatus; // Used for send R/C from DSZ
- int RecvStatus; // Used for receive R/C from DSZ
- int TrackStatus; // Track status of join conf cmd
- int trMainCMDprompt; // Track Main Conf prompt
- int trConfCMDprompt; // Track Conf Prompt
- int trMailDoorReady; // Track Mail door ready
- int trDSZDLPrompt; // track DSZ D/L '**'
- int trMsgPrompt; // Track messages prompt
- int TimerHandle; // Timer track for logon
-
- str sizestring[10] ;
- str Join_Command[16] = "J " ;
- str Open_Command[16] = "OPEN " ;
- str One_line[80];
- str One_liner[80];
-
- main()
- {
- _time_format = 1; // use 24-hour format time
-
- screen(); // send screen
- load_values(); // load values from cfg
- Telix_init(); // control telix files
- gotoxy(59,6); // position cursor = 6
- printsc("In Progress .."); // startup in progress
- screen(); // send initial screen
- del_dszlog(); // clear out DSZLOG
- gotoxy(59,6); // position cursor = 6
- printsc("Complete "); // startup in progress
- gotoxy(59,7); // position cursor = 7
- printsc("Not Available Yet"); // Starlink/PCP status
- debug = 0; // debug off
- gotoxy(59,8); // position cursor = 8
- printsc("Dialing Hub"); // Logon status
-
- dial_BBS:
-
- //
- // Dial the hub for the specified period of time.
- //
- if (not carrier ())
- {
- hangup();
- cputs_tr("ATZ~^M"); // reset the modem
- delay(20);
- cputs_tr("AT~S7=45S0=0S11=40V1E1X7&B1&H1&K0M0L3^M~~");
- delay(20);
- ustamp( "Beginning dial attempt." , 1 , 1 ) ;
- DialStat = dial(dial_str , dial_cnt , TRUE ) ;
- }
-
- delay(50); // wait for a carrier
- if (not carrier ())
- {
- ustamp("unable to connect to HUB",1,1);
- ustamp( "Relay failed: Dialing Timeout." , 1 , 1 ) ;
- ustamp( "------------------------------" , 1 , 1 ) ;
- cputs_tr("ATH1~^M"); // exit after giving up
- exittelix( 1 , 1 ) ;
- }
- screen(); // reset to correct baud rate
- if (not _entry_pass) // Check for Correct Password
- {
- alarm(1);
- prints ("Sorry, I can't find the password for this BBS!");
- cputs_tr("ATH1~^M");
- goto halt_telix;
- }
-
- if ( ( LogonStat = logon() ) != 0) {
- alarm( 1 ) ;
- status_wind( "Logon failed - TIMEOUT" , 2 ) ;
- ustamp( "Relay Failed: Logon Timeout" , 1 , 1 ) ;
- ustamp( "------------------------------" , 1 , 1 ) ;
- error_count = Error_count + 1;
- if (error_count == 5) {
- capture( "*CLOSE*" ) ;
- exittelix( 1 , 1 ) ;
- }
- Hangup();
- goto Dial_BBS;
- }
-
- //
- // We are now sitting at the main board command prompt. Set up a couple
- // of tracks to get us to the mail door and a timer just in case.
- //
- gotoxy(59,9); // position cursor = 9
- printsc("Pending "); // Conf Join
- if ( TrackStatus == trMsgPrompt )
- cputs( "N^M" ) ;
- if ( TrackStatus == trMailDoorReady )
- goto sendit;
-
-
- resend: // Branch point to reopen door
-
- Track_free(0); // Free all tracks
-
- trMainCMDPrompt = track( "Command?" , 0 ) ;
- trConfCMDPrompt = track( "Conference Command?" , 0 ) ;
- trMailDoorReady = track( Open_Command , 0 ) ;
- trMsgPrompt = track( " personal mail: (Enter)=yes? " , 0 );
-
- Door_Timer = timer_start( 1800 ) ;
- if ( Hub_conf != "0")
- {
- gotoxy(59,9); // position cursor = 9
- printsc("Joining Conf "); // Conf Join
- cputs( Join_Command ) ;
- }
- else
- {
- gotoxy(59,9); // position cursor = 9
- printsc("Not Needed "); // Conf Join
- gotoxy(59,10); // position cursor = 10
- printsc("Opening Door "); // Conf Join
- cputs( Open_command ); // open the door
- }
-
-
- while ( ! time_up( Door_Timer ) ) {
- // if (cinp_cnt()) { // Process any characters and keys
- // Comm_byte = cgetc();
- // track_addchr(comm_byte);
- // screen_io();
- // }
- if (cinp_cnt())
- track_addchr(cgetc());
-
- TrackStatus = track_hit(0); // Determine which track (if any)
-
- if (TrackStatus == 0)
- continue;
-
- if ( TrackStatus == trConfCMDPrompt ) {
- if (hub_conf != "0")
- {
- gotoxy(59,9); // position cursor = 9
- printsc("Conference Joined"); // Conf Join
- gotoxy(59,10); // position cursor = 10
- printsc("Opening the door "); // Conf Join
- cputs( Open_Command ) ;
- } else
- cputs( "A^M" );
-
-
- track_free( trConfCMDPrompt ) ;
- }
-
- if ( TrackStatus == trMainCMDPrompt ) {
- gotoxy(59,9); // position cursor = 9
- printsc("Not Needed "); // Conf Join
- gotoxy(59,10); // position cursor = 10
- printsc("Opening door "); // Conf Join
- cputs( Open_Command ) ;
- track_free( trConfCMDPrompt ) ;
- }
-
- if ( TrackStatus == trMsgPrompt )
- cputs( "N^M" ) ;
- if ( TrackStatus == trMailDoorReady )
- break ;
-
- }
-
- if ( time_up( Door_Timer ) ) { // failed to open door
- ustamp( "Relay Failed: No Door! " , 1 , 1 ) ;
- ustamp( "------------------------------" , 1 , 1 ) ;
- cputs( "g^M" ) ;
- exittelix( 1 , 1 ) ;
- }
- //
- // We are at the door and ready to send!
- //
-
- sendit: //jump point for ProLogon door menu
-
- timer_free(Door_Timer); // Free timer channel
- track_free(0); // and all track channels
-
- upload_log(); // log what we are sending
-
- gotoxy(59,10); // position cursor = 10
- printsc("Door now open"); // Door status
- gotoxy(59,11); // position cursor = 11
- printsc("In progress"); // Upload status
-
- delay(90);
-
- if (not carrier()) // If we lost carrier
- goto dial_BBS; // go try calling again
-
- //
- // We are at the door and ready to send!
- //
- SendStatus = run( Protocol , Send_Command , 0 ) ;
- //
- // Stamp the log with the size of the file sent
- //
- if ( SendStatus == 0 ) {
- gotoxy(59,11); // position cursor = 11
- printsc("Successful "); // Upload status
- ustamp( "Relay Upload successful." , 1, 1 ) ;
- copy_dszlog();
- } else {
- gotoxy(59,11); // position cursor = 11
- printsc("Aborted "); // Upload status
- ustamp( "Relay Failed: Send failed." , 1 , 1 ) ;
- ustamp( "------------------------------" , 1 , 1 ) ;
- Hangup();
- exittelix( 1 , 0 ) ;
- }
-
- TimerHandle = timer_start( 50 ) ; // wait for 5 seconds
-
- while ( not time_up( TimerHandle ) ) {
- if (cinp_cnt())
- track_addchr(cgetc());
-
- }
-
- trMainCMDPrompt = track( "Command?" , 0 );
- trConfCMDPrompt = track( "Conference Command?" , 0 ) ;
- trDSZDLPrompt = track( "**" , 1 ) ;
-
- gotoxy(59,12); // position cursor = 12
- printsc("Awaiting start"); // Download status
-
- //
- // After 5 minutes the logon is assumed to have failed.
- //
- TimerHandle = timer_start( 9000 ) ; // wait for 15 minutes
-
- while ( not time_up( TimerHandle ) ) {
- // if (cinp_cnt()) { // Process any characters and keys
- // Comm_byte = cgetc();
- // track_addchr(comm_byte);
- // screen_io();
- // }
- if (cinp_cnt())
- track_addchr(cgetc());
-
- trackStatus = track_hit(0); // Determine which track (if any)
-
- if (trackStatus == 0)
- continue;
-
- if ( trackStatus == trConfCMDPrompt ) {
- timer_free(TimerHandle); // Free timer channel
- track_free(0); // and all track channels
- goto resend;
- } else if ( trackStatus == trMainCMDPrompt ) {
- timer_free(TimerHandle); // Free timer channel
- track_free(0); // and all track channels
- goto resend;
- } else if ( trackStatus == trDSZDLPrompt ) {
- timer_free(TimerHandle); // Free timer channel
- track_free(0); // and all track channels
- gotoxy(59,12); // position cursor
- printsc("Started "); // Download status
- ustamp("Receive of mail packet started", 1, 1);
- RecvStatus = run( Protocol , Recv_command , 0 );
- break;
- }
- }
-
-
- //
- // Stamp the log with the size of the file received
- //
- if ( RecvStatus == 0 ) {
- gotoxy(59,12); // position cursor
- printsc("Successful"); // Download status
- download_log(); // log successful transfer
- copy_dszlog(); // save DSZ information
- hangup(); // Hang up on hub
- cputs_tr("AT H1^M"); // keep phone off hook
- Mail_save(); // Save the Mail after xfer
- logwork = "ECHO Transfer Good! > "; // let's build Good file
- strcat(logwork, Mail_run_good); // add target name
- dos(logwork, 2); // do command
- Ustamp(logwork, 1, 0); // log command
- Ustamp(" performed", 0, 1);
- } else {
- copy_dszlog(); // save dsz information
- gotoxy(59,12); // position cursor
- printsc("Aborted "); // Download status
- gotoxy(59,13); // position cursor
- printsc("IN.RLY deleted"); // Mail Save status
- logwork = "DEL "; // Build DEL command
- strcat(logwork, Mail_file); // Add D/L file name
- strcat(logwork, " >NUL"); // Send O/P to null
- dos(logwork, 2); // execute dos command
- ustamp( "Relay Failed: Receive failed." , 1 , 1 ) ;
- Ustamp( Mail_file, 1, 0);
- Ustamp( " has been deleted.", 0, 1);
- ustamp( "------------------------------" , 1 , 1 ) ;
- Hangup();
- exittelix(1,0);
- }
-
- //
- // reset all default values
- //
-
- _down_dir = old_down_dir; // Reset Download/Upload Directories
- _up_dir = old_up_dir; // to their Normal Settings
- delay(1);
- cputs_tr("ATH1~^M"); // exit with phone off hook,
- ustamp( "------------------------------", 1 , 1 ) ;
- usagelog( "*CLOSE*" ) ;
- capture("*CLOSE*");
- dos( "del hubrelay.cap > NUL" , 2 ) ;
- exittelix(0, 1);
-
- //
- // exit script on password error in directory
- //
-
- halt_telix:
- prints("Please edit the Dialing Directory entry and enter");
- prints("a PASSWORD for it.");
-
- }
-
- //*****************************************************************************
- //
- // Screen() builds the mail transfer user screen
- //
- //*****************************************************************************
-
- screen() {
-
- //
- // clear the screen and build default headings and colors
- //
- if (first_time == 0)
- {
- _back_color = 01; // Set background to blue
- _fore_color = 15; // Set Foreground to white
- clear_scr(); // clear the screen
- box( 0,0,79,23,0,1,31); // color the whole screen
- }
-
- //
- // Show script start time in upper left corner
- //
- if (first_time == 0)
- {
- date(curtime(), logwork);
- gotoxy(0, 0);
- printsc("Start Date: ");
- printsc(logwork);
- time(curtime(), logwork);
- gotoxy(0, 1);
- printsc(" Time: ");
- printsc(logwork);
- }
-
- //
- // Draw RelayNet Transmission box on top center of screen
- //
- if (first_time == 0)
- {
- box( 20, 0,59, 2, 2, 0,31); // draw Relaynet box
- pstraxy("RelayNet(tm) Transmission", 28, 1,11);
- }
-
- //
- // Draw box on bottom of screen for captured data to be displayed
- //
- if (first_time == 0)
- {
- box(0,16,79,23,2,0,31);
- gotoxy(14,20);
- // printsc("Area reserved for screen I/O when I figure out how!");
- }
-
- //
- // Draw left-hand side box and fill in values
- //
- if (first_time == 0)
- {
- box(0,3,39,15,2,0,31); // draw left side box
- gotoxy(1,4); // position cursor
- printsc(" Node ID: "); // who is calling
- gotoxy(1,5); // position cursor
- printsc("Connecting to: "); // where are you calling
- gotoxy(1,6); // position cursor
- printsc(" Baud Rate: "); // move in connect speed
- gotoxy(1,7); // position cursor
- printsc(" Comm Port: "); // identify which comm port
- gotoxy(1,8); // position cursor
- printsc(" User Name: "); // label user login id
- gotoxy(1,9); // position cursor
- printsc(" Upload Dir: "); // label mail upload dir
- gotoxy(1,10); // position cursor
- printsc(" Packet: "); // label upload file name
- gotoxy(1,11); // position cursor
- printsc(" Create Date: "); // label create date
- gotoxy(1,12); // position cursor
- printsc(" Time: "); // label create time
- gotoxy(1,13); // position cursor
- printsc(" Packet Size: "); // label upload size
- gotoxy(1,14); // position cursor
- printsc(" Download Dir: "); // label dir name
- }
- gotoxy(16,4); // position cursor
- printsc(Node_name); // move in node name
- gotoxy(16,5); // position cursor
- printsc(hub_name); // move in hub name
- gotoxy(16,6); // position cursor
- printn(get_baud()); // print out baud rate
- gotoxy(16,7); // position cursor
- printn(get_port()); // print out commport value
- gotoxy(16,8); // position cursor
- printsc(user_name); // print off user name
- gotoxy(16,9); // position cursor
- printsc(" "); // print off value
- gotoxy(16,9); // position cursor
- strupper(_up_dir); // convert string to upper
- printsc(_up_dir); // print off value
- gotoxy(16,10); // position cursor
- printsc(up_packet); // print off file name
- gotoxy(16,11); // position cursor
- printsc(" "); // print off create date
- gotoxy(16,11); // position cursor
- printsc(node_date); // print off create date
- gotoxy(16,12); // position cursor
- printsc(node_time); // print off create time
- gotoxy(16,13); // position cursor
- printsc(node_size); // print off file size
- gotoxy(16,14); // position cursor
- printsc(" "); // print off value
- gotoxy(16,14); // position cursor
- strupper(_down_dir); // convert string to upper
- printsc(_down_dir); // print mail target dir
-
- //
- // draw box on right-hand side of screen
- //
- if (first_time == 0)
- {
- box(40,3,79,15,2,0,31); // draw right box
- gotoxy(41,4); // position cursor
- printsc(" Current Session Status"); // heading
- gotoxy(41,5); // position cursor
- printsc(" ----------------------"); // heading
- gotoxy(41,6); // position cursor
- printsc(" Initialization:"); // startup status
- gotoxy(41,7); // position cursor
- printsc(" StarLink/PCP:"); // Starlink status
- gotoxy(41,8); // position cursor
- printsc(" Logon:"); // logon status
- gotoxy(41,9); // position cursor
- printsc(" Conference Join:"); // conf join status
- gotoxy(41,10); // position cursor
- printsc(" Opening Door:"); // door status
- gotoxy(41,11); // position cursor
- printsc(" Upload:"); // upload status
- gotoxy(41,12); // position cursor
- printsc(" Download:"); // download status
- gotoxy(41,13); // position cursor
- printsc("Mail file backup:"); // backup status
- gotoxy(59,6); // position cursor
- printsc("In Progress ."); // startup in progress
- gotoxy(59,6); // position cursor
- }
-
- if (first_time == 0)
- first_time = 1;
-
- }
- //*****************************************************************************
- //
- // Logon() logs on to a ProLogon/ProDoor host.
- //
- //*****************************************************************************
-
- Logon() {
-
- str ENTER[2] = "^M" ;
-
- int trGraphicsPrompt, trNamePrompt, trPWPrompt, trEnterPrompt;
- int trMsgPrompt, trConfCMDPrompt , trMainCMDPrompt , trMorePrompt ;
- int trLangPrompt , trProLogonPrompt ;
- int trStatus , TimerHandle, ShortTimer ;
- trLangPrompt = track( "(Enter)='1'? ", 0 );
- trGraphicsPrompt = track( "graphics: (Enter)=no? " , 0 );
- trNamePrompt = track( "name?" , 0 );
- trPWPrompt = track( "password?" , 0 );
- trEnterPrompt = track( "Press (Enter) to continue:" , 0 );
- trMsgPrompt = track( " personal mail: (Enter)=yes? " , 0 );
- trProLogonPrompt = track( "stem (Enter)='1'? " , 0 );
- trMainCMDPrompt = track( "Command?" , 0 );
- trConfCMDPrompt = track( "Conference Command?" , 0 ) ;
- trMorePrompt = track( "(NS)non-stop?" , 0 ) ;
- trProLogonPrompt = track( "ystem (Enter)='1'? " , 0 ) ;
- //
- // Build the commands for one line logon (ProLogon)
- //
-
- One_line = "1 N QQ ";
- One_liner = "N QQ ";
- strcat(One_line , User_Name);
- strcat(One_liner , User_Name);
- strcat(One_line , " ");
- strcat(One_liner , " ");
- strcat(One_line , _entry_pass);
- strcat(One_liner , _entry_pass);
- strcat(One_line , " ");
- strcat(One_liner , " ");
- strcat(One_line , Hub_Door);
- strcat(One_liner , Hub_Door);
- strcat(One_line , " ");
- strcat(One_liner , " ");
- strcat(One_line , "NS");
- strcat(One_liner , "NS");
- strupper(One_line);
- strupper(One_liner);
-
- //
- // After 3 minutes the logon is assumed to have failed.
- //
- TimerHandle = timer_start( 1800 ) ; // 3 min time to logon
- ShortTimer = timer_start( 100 ) ; // 10 secs for graphics
-
- while ( not time_up( TimerHandle ) ) {
- if (cinp_cnt()) // Process any characters and keys
- track_addchr(cgetc());
-
- trStatus = track_hit(0); // Determine which track (if any)
-
- if (time_up (ShortTimer) ) {
- track_free(0);
- timer_free (TimerHandle);
- timer_free (ShortTimer);
- gotoxy(59,8);
- printsc("Completed ");
- gotoxy(59,10);
- printsc("Opening door ");
- cputs( One_liner ) ; cputs( ENTER ) ;
- return ( 0 ) ;
- }
-
-
- if (trStatus == 0)
- continue;
-
-
- if (trStatus == trLangPrompt) {
- cputs ( One_line ) ; cputs( ENTER ) ;
- track_free(0);
- timer_free (TimerHandle);
- timer_free (ShortTimer);
- gotoxy(59,8);
- printsc("Completed ");
- gotoxy(59,10);
- printsc("Opening door ");
- return ( 0 ) ;
- }
-
- if ( trStatus == trGraphicsPrompt ) {
- cputs( One_liner ) ; cputs( ENTER ) ;
- track_free(0);
- timer_free (TimerHandle);
- timer_free (ShortTimer);
- gotoxy(59,8);
- printsc("Completed ");
- gotoxy(59,10);
- printsc("Opening door ");
- return ( 0 ) ;
- }
-
- if ( trStatus == trNamePrompt ) {
- cputs( User_Name ) ; cputs( ENTER ) ;
- gotoxy(59,8);
- printsc("Awaiting Password");
- track_free( trNamePrompt ) ;
- }
-
- if ( trStatus == trPWPrompt ) {
- cputs( _entry_pass ) ; cputs( ENTER );
- gotoxy(59,8);
- printsc("Signon Complete ");
- track_free( trPWPrompt ) ;
- }
-
- if ( trStatus == trEnterPrompt )
- cputs( ENTER ) ;
-
- if ( trStatus == trMsgPrompt || trStatus == trMorePrompt ) {
- cputs( "N" ) ; cputs( ENTER ) ;
- track_free( trMsgPrompt ) ;
- }
-
- if ( trStatus == trConfCMDPrompt ) {
- cputs( "A" ) ; cputs( ENTER ) ;
- track_free( trConfCMDPrompt ) ;
- }
-
- if ( trStatus == trMainCMDPrompt ) {
- track_free(0);
- timer_free (TimerHandle);
- timer_free (ShortTimer);
- gotoxy(59,8);
- printsc("Completed ");
- return ( 0 ) ;
- }
-
- if ( trStatus == trProLogonPrompt ) {
- track_free(0);
- timer_free (TimerHandle);
- timer_free (ShortTimer);
- gotoxy(59,8);
- printsc("Completed ");
- gotoxy(59,10);
- printsc("Opening door ");
- cputs( hub_door ) ; cputs( ENTER ) ;
- return ( 0 ) ;
- }
- }
-
- track_free( 0 ) ;
- timer_free( TimerHandle ) ;
- timer_free( ShortTimer ) ;
- // prints( "Logon failed - TIMEOUT" ) ;
- return( -1 ) ;
- }
-
- //
- // Copy contents of DSZLOG to the Usage log for statistical purposes
- //
- copy_dszlog()
- {
- fh = fopen(dszlog,"r");
- fgets(logwork, 100, fh);
- ustamp(logwork , 0 , 1);
- fclose(fh);
- del_dszlog();
-
- }
-
- //
- // Delete DSZLOG because we do not need it anymore
- //
- del_dszlog()
- {
- str cmdwork[100];
-
- cmdwork = "del "; // set log work with cmnd
- strcat(cmdwork, dszlog); // add DSZLOG file name
- strcat(cmdwork, " > nul"); // Add redir to null
- if (filefind(dszlog, 0, logwork)) {
- dos(cmdwork, 2);
- Ustamp(cmdwork, 1, 0);
- ustamp(" performed", 0, 1);
- }
- }
-
- //
- // Load values from the script configuration file
- //
- load_values()
- {
- //
- // Read all initialization values from CFG file
- //
-
- //
- // Clean up all values and save defaults
- //
- init_values();
-
- }
-
- //
- // Clean up all initial values before screen display
- //
- init_values()
- {
- str portwork[1];
- str cmdwork[64], cmdwork2[64];
- str dir_work[64];
- //
- // Preserve all default values
- //
- old_alarm_on = _alarm_on; // preserve alarm value
- old_zmod_auto = _zmod_auto; // preserve zmodem auto
- old_down_dir = _down_dir; // preserve old d/l directory
- old_up_dir = _up_dir; // preserve old u/l directory
-
- //
- // Set up our new overrides to standard defaults
- //
- _alarm_on = 0; // turn alarm off
- _zmod_auto = 0; // turn Auto zmodem off
- _down_dir = mail_download; // set up d/l directory
- _up_dir = mail_upload; // set up u/l directory
- //
- // Convert all variable to upper case for consistancy
- //
- strupper(user_name); // convert string to upper
- strupper(node_name); // convert string to upper
- strupper(hub_name); // convert string to upper
- strupper(_down_dir); // convert string to upper
- strupper(_up_dir); // convert string to upper
-
- //
- // Build upload packet name and get it's date/time/size into variables
- //
- up_packet = node_name; // prime packet w/node name
- strcat(up_packet, ".RLY"); // add .RLY extention
-
- up_file = _up_dir; // put in u/l dir name
- strcat(up_file, up_packet); // add packet name
- if (filefind(up_file, 0, logwork))
- {
- n_isize = filesize(up_file); // determine file size
- itos(n_isize, node_size); // determine file size
- n_itime = filetime(up_file); // determine file time
- time(n_itime, node_time); // determine file time
- date(n_itime, node_date); // determine file date
- }
- //
- // Build Download packet name
- //
- Mail_packet = "IN.RLY"; // prime packet w/node name
- Mail_file = _down_dir; // put in u/l dir name
- strcat(Mail_file, mail_packet); // add packet name
- //
- // Build the commands "j <conf> q" and "open <door>"
- //
- strcat( Join_Command , hub_conf ) ;
- strcat( Join_Command , " q ns^M" ) ;
- strcat( Open_Command , hub_door ) ;
- strcat( Open_Command , "^M" ) ;
-
- //
- // Build DSZ commands for mail transfer
- //
- cmdwork = " port ";
- itos((get_port()), portwork);
- strcat(cmdwork, portwork);
- cmdwork2 = cmdwork;
- strcat(cmdwork2, " ");
- strcat(cmdwork2, send_command);
- strcat(cmdwork2, " ");
- send_command = cmdwork2;
-
- cmdwork2 = cmdwork;
- strcat(cmdwork2, " ");
- strcat(cmdwork2, recv_command);
- strcat(cmdwork2, " ");
- recv_command = cmdwork2;
-
- //
- // Build command line with file name for send
- //
- strcat(Send_Command, _up_dir); // Add upload dir to cmnd
- strcat(Send_Command, up_packet); // Add packet name to cmnd
- // strcat(Send_Command, " > "); // set up redirection
- // strcat(Send_Command, DSZ_Screen_Log); // add target name
-
- //
- // Build command line with download directory for receive
- //
- strcat(Recv_command, _down_dir);
- strcat(Recv_command, "IN.RLY");
- // strcat(Recv_Command, " >> "); // set up redirection
- // strcat(Recv_Command, DSZ_Screen_Log); // add target name
-
-
- }
-
- //
- // Log to daily log the status of the file transfer
- //
- upload_log()
- {
- message_work = "Uploading RelayNet(tm) packet: ";
- strcat(message_work, up_packet);
- ustamp(message_work, 1,1);
-
- message_work = "From directory: ";
- strcat(message_work, _up_dir);
- ustamp(message_work, 1,1);
-
- message_work = "Created on ";
- strcat(message_work, node_date);
- strcat(message_work, " at ");
- strcat(message_work, node_time);
- strcat(message_work, " size: ");
- strcat(message_work, node_size);
- strcat(message_work, " bytes");
- ustamp(message_work, 1,1);
- }
-
- download_log()
- {
- node_packet = "IN.RLY"; // prime packet w/node name
- node_file = _down_dir; // put in d/l dir name
- strcat(node_file, node_packet); // add packet name
- n_isize = filesize(node_file); // determine file size
- itos(n_isize, node_size); // determine file size
- n_itime = filetime(node_file); // determine file time
- time(n_itime, node_time); // determine file time
- date(n_itime, node_date); // determine file date
- message_work = "Received RelayNet(tm) packet: ";
- strcat(message_work, "IN.RLY");
- ustamp(message_work, 1,1);
-
- message_work = "Into directory: ";
- strcat(message_work, _up_dir);
- ustamp(message_work, 1,1);
-
- message_work = "Created on ";
- strcat(message_work, node_date);
- strcat(message_work, " at ");
- strcat(message_work, node_time);
- strcat(message_work, " size: ");
- strcat(message_work, node_size);
- strcat(message_work, " bytes");
- ustamp(message_work, 1,1);
- }
-
- //
- // Telix file initialization
- //
- telix_init()
- {
- //
- // Open a capture file for future diagnostics
- //
- if ( ! capture_stat() )
- if ( capture( "hubrelay.cap" ) == -1 )
- prints( "Unable to capture." ) ;
- //
- // Initialize special log
- //
- if ( usage_stat() )
- usagelog( "*CLOSE*" ) ;
- usagelog( mail_log_file ) ;
- ustamp( "------------------------------" , 1 , 1 ) ;
-
- //
- // Delete Mail_run_good file so we won't pack and reset the messages
- //
- if (filefind(Mail_run_good, 0, logwork)) {
- logwork = "DEL ";
- strcat(logwork, Mail_run_good);
- strcat(logwork, " > nul");
- dos(logwork, 2);
- Ustamp(logwork, 1, 0);
- ustamp(" performed", 0, 1);
- }
- }
-
- //
- // Mail preservation routine
- //
- Mail_Save() {
-
- str from_name[64], To_name[64], command_work[127], ext_work[3];
- str name_work[12];
- int Work_counter;
-
- Work_counter = stoi(Save_count);
-
- If (Work_counter > 0){
- gotoxy(59,13); // position cursor
- printsc("Oldest U/L deleted"); // Mail Save status
- delay(30);
- itos(Work_counter, Ext_work);
- name_work = node_name;
- strcat(name_work, ".");
- strcat(Name_work, ext_work);
- command_work = "DEL ";
- from_name = Mail_save_dir;
- strcat(from_name, name_work);
- strcat(command_work, from_name);
- strcat(command_work, " > nul");
- if (filefind(from_name, 0, logwork)) {
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- }
- gotoxy(59,13); // position cursor
- printsc("Renaming Uploads "); // Mail Save status
- delay(30);
- while(Work_counter > 1) {
- itos(Work_counter, Ext_work);
- name_work = Node_name;
- strcat(name_work, ".");
- strcat(Name_work, ext_work);
- To_name = name_work;
- Work_counter = Work_counter - 1;
- itos(Work_counter, Ext_work);
- name_work = Node_name;
- strcat(name_work, ".");
- strcat(Name_work, ext_work);
- From_name = Mail_save_dir;
- strcat(From_name, name_work);
- command_work = "RENAME ";
- strcat(command_work, from_name);
- strcat(command_work, " ");
- strcat(command_work, To_name);
- strcat(command_work, " > nul");
- if (filefind(from_name, 0, logwork)) {
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- }
- }
- gotoxy(59,13); // position cursor
- printsc("Copying new Upload"); // Mail Save status
- delay(30);
- command_work = "COPY ";
- strcat(command_work, up_file);
- strcat(command_work, " ");
- strcat(command_work, from_name);
- strcat(command_work, " > Nul");
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- gotoxy(59,13); // position cursor
- Work_counter = stoi(Save_count);
- printsc("Delete oldest D/L "); // Mail Save status
- delay(30);
- itos(Work_counter, Ext_work);
- name_work = "IN.";
- strcat(Name_work, ext_work);
- command_work = "DEL ";
- from_name = Mail_save_dir;
- strcat(from_name, name_work);
- strcat(command_work, from_name);
- strcat(command_work, " > nul");
- if (filefind(from_name, 0, logwork)) {
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- }
- gotoxy(59,13); // position cursor
- printsc("Renaming downloads"); // Mail Save status
- delay(30);
- while(Work_counter > 1) {
- itos(Work_counter, Ext_work);
- name_work = "IN.";
- strcat(Name_work, ext_work);
- To_name = name_work;
- Work_counter = Work_counter - 1;
- itos(Work_counter, Ext_work);
- name_work = "IN.";
- strcat(Name_work, ext_work);
- From_name = Mail_save_dir;
- strcat(From_name, name_work);
- command_work = "RENAME ";
- strcat(command_work, from_name);
- strcat(command_work, " ");
- strcat(command_work, To_name);
- strcat(command_work, " > nul");
- if (filefind(from_name, 0, logwork)) {
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- }
- }
- gotoxy(59,13); // position cursor
- printsc("Copying new download"); // Mail Save status
- delay(30);
- command_work = "COPY ";
- strcat(command_work, Mail_file);
- strcat(command_work, " ");
- strcat(command_work, from_name);
- strcat(command_work, " > Nul");
- dos(command_work, 2);
- Ustamp(command_work, 1, 0);
- ustamp(" performed", 0, 1);
- }
- }
-